package cn.csc.module.product.controller.app.atttr;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.module.product.controller.admin.attr.vo.AttrRespVO;
import cn.csc.module.product.convert.attr.AttrConvert;
import cn.csc.module.product.dal.dataobject.attr.AttrDO;
import cn.csc.module.product.service.attr.AttrService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;

import static cn.csc.framework.common.pojo.CommonResult.success;

/**
 *
 * @author 云隐
 * @version 1.0
 * @date 2024/1/4 14:04
 * @modify
 */
@Api(tags = "用户 APP - 属性信息")
@RestController("appAttrController")
@RequestMapping("/product/attr")
@Validated
@Slf4j
@Setter
public class AppAttrController {

    @Autowired
    private AttrService attrService;

    @GetMapping
    @Operation(summary = "获取属性信息" , description = "根据attrId获取属性信息")
    public CommonResult<AttrRespVO> getByAttrId(@RequestParam BigInteger attrId) {
        AttrDO attrDO = attrService.getByAttrId(attrId);
        return success(AttrConvert.INSTANCE.convert(attrDO));
    }



}
